@extends('admin/layout')

@section('title', $title)

@section('content')
<div class="content-wrapper" style="min-height: 946px;">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                用户管理
                <small>编辑用户</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="{{ url('/admin/index') }}"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li><a href="#">用户管理</a></li>
                <li class="active">编辑用户</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-6 col-md-offset-3">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">

                            <h3 class="box-title">编辑用户</h3>
                            @if (count($errors) > 0)
                                <div class="callout callout-info" id='jg'>
                                    <h3>出错啦!╮(╯▽╰)╭</h3>
                                    <ul>
                                        @foreach ($errors->all() as $error)
                                            <li>{{ $error }}</li>
                                        @endforeach
                                    </ul>
                                </div>
                            @endif
                            @if (session('info'))
                                <div class="callout callout-info" id='jg'>
                                    <h3>出错啦!╮(╯▽╰)╭</h3>
                                    <ul>
                                        {{ session('info') }}
                                    </ul>
                                </div>
                            @endif
                        </div><!-- /.box-header -->
                        <!-- form start -->
                        <form role="form" action="{{ url('/admin/user/doedit') }}" method='post' enctype="multipart/form-data">
                            <div class="box-body">
                                {{ csrf_field() }}
                                <div class="form-group">
                                    <label for="exampleInputEmail1">注册邮箱</label>
                                    <input class="form-control" id="exampleInputEmail1" placeholder="{{ $data -> email }}" value="{{ $data -> email }}" type="text" name='email' disabled="disabled" >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">密码</label>
                                    <input class="form-control" id="exampleInputPassword1" placeholder="请输入密码6-18位" type="password" name="password">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputPassword1">确认密码</label>
                                    <input class="form-control" id="exampleInputPassword2" placeholder="请再次输入密码6-18位" type="password" name='repassword'>
                                </div>
                                <!-- <div class="form-group">
                                    <label for="exampleInputPassword1">昵称</label>
                                    <input class="form-control" id="exampleInputPassword1" placeholder="请输入密码6-18位" type="text" name="nickname">
                                </div>
                                
                                <div class="form-group">
                                    <label for="exampleInputPassword1">电话</label>
                                    <input class="form-control" id="exampleInputPassword1" placeholder="请输入密码6-18位" type="text" name="phone">
                                </div> -->

                                <div class="form-group">
                                    <label for="exampleInputFile">上传头像</label>
                                    <input id="exampleInputFile" type="file" name='pic'>
                                    <p class="help-block">请选择要上传的头像文件</p>
                                    <input type="hidden" name="id" value="{{ $data -> id }}">
                                </div>
                                <div class="checkbox">
                                    <label>
                                         <input type="radio" value="1" name='admin_user' checked="checked" > 管理员
                                    </label>
                                    <label>
                                         <input type="radio" name='admin_user'> 普通用户
                                    </label>
                                </div>
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">提交</button>
                                <button type="reset" class="btn btn-default">重置</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </section><!-- /.content -->
    </div>

    <script type="text/javascript">
        //隐藏警告信息
        window.onload = function()
        {
            setInterval(function(){
                $('#jg').slideUp()
            },3000);
        }


    </script>
@endsection